' ************************************************************************** ' ' Multimedia API Declares adapted from WINMMSYS.TXT ' in turn taken from MMSYSTEM.H ' ' Copyright (c) 1990-1993, Microsoft Corp. All rights reserved. ' ' ************************************************************************** ' *************************************************************************** ' General constants and data types ' ****************************************************************************/ ' general constants Global Const MAXPNAMELEN = 32 ' max product name length (including NULL) Global Const MAXERRORLENGTH = 128 ' max error text length (including NULL) Type RECT ' Same as Windows API left As Integer top As Integer right As Integer bottom As Integer End Type ' MMTIME data structure Type SMPTE hour As String * 1 ' hours min As String * 1 ' minutes sec As String * 1 ' seconds frame As String * 1 ' frames fps As String * 1 ' frames per second dummy As String * 1 ' pad End Type Type MMTIME wType As Integer ' indicates the contents of units units As Long ' (msecs, samples, bytes) SMPTEVal As SMPTE songptrpos As Long ' song pointer position End Type ' types for wType field in MMTIME struct Global Const TIME_MS = &H1 ' time in milliseconds Global Const TIME_SAMPLES = &H2 ' number of wave samples Global Const TIME_BYTES = &H4 ' current byte offset Global Const TIME_SMPTE = &H8 ' SMPTE time Global Const TIME_MIDI = &H10 ' MIDI time ' *************************************************************************** ' Manufacturer and product IDs ' Used with wMid and wPid fields in WAVEOUTCAPS, WAVEINCAPS, ' MIDIOUTCAPS, MIDIINCAPS, AUXCAPS, JOYCAPS structures. ' ****************************************************************************/ ' manufacturer IDs Global Const MM_MICROSOFT = 1 ' Microsoft Corp. ' product IDs Global Const MM_MIDI_MAPPER = 1 ' MIDI Mapper Global Const MM_WAVE_MAPPER = 2 ' Wave Mapper Global Const MM_SNDBLST_MIDIOUT = 3 ' Sound Blaster MIDI output port Global Const MM_SNDBLST_MIDIIN = 4 ' Sound Blaster MIDI input port Global Const MM_SNDBLST_SYNTH = 5 ' Sound Blaster internal synthesizer Global Const MM_SNDBLST_WAVEOUT = 6 ' Sound Blaster waveform output Global Const MM_SNDBLST_WAVEIN = 7 ' Sound Blaster waveform input Global Const MM_ADLIB = 9 ' Ad Lib-compatible synthesizer Global Const MM_MPU401_MIDIOUT = 10 ' MPU401-compatible MIDI output port Global Const MM_MPU401_MIDIIN = 11 ' MPU401-compatible MIDI input port Global Const MM_PC_JOYSTICK = 12 ' Joystick adapter ' *************************************************************************** ' General MMSYSTEM support ' ****************************************************************************/ Declare Function mmsystemGetVersion Lib "MMSYSTEM" () As Integer Declare Sub OutputDebugStr Lib "MMSYSTEM" (ByVal LPCSTR As String) ' *************************************************************************** ' Sound support ' ****************************************************************************/ Declare Function sndPlaySound Lib "MMSYSTEM" (ByVal lpszSoundName As String, ByVal uFlags As Integer) As Integer ' flag values for wFlags parameter Global Const SND_SYNC = &H0 ' play synchronously (default) Global Const SND_ASYNC = &H1 ' play asynchronously Global Const SND_NODEFAULT = &H2 ' don't use default sound Global Const SND_MEMORY = &H4 ' lpszSoundName points to a memory file Global Const SND_LOOP = &H8 ' loop the sound until next sndPlaySound Global Const SND_NOSTOP = &H10 ' don't stop any currently playing sound ' *************************************************************************** ' MIDI audio support ' ****************************************************************************/ ' MIDI error return values Global Const MIDIERR_UNPREPARED = (MIDIERR_BASE + 0) ' header not prepared Global Const MIDIERR_STILLPLAYING = (MIDIERR_BASE + 1) ' still something playing Global Const MIDIERR_NOMAP = (MIDIERR_BASE + 2) ' no current map Global Const MIDIERR_NOTREADY = (MIDIERR_BASE + 3) ' hardware is still busy Global Const MIDIERR_NODEVICE = (MIDIERR_BASE + 4) ' port no longer connected Global Const MIDIERR_INVALIDSETUP = (MIDIERR_BASE + 5) ' invalid setup Global Const MIDIERR_LASTERROR = (MIDIERR_BASE + 5) ' last error in range Global Const MIDIPATCHSIZE = 128 ' MIDI callback messages Global Const MIM_OPEN = MM_MIM_OPEN Global Const MIM_CLOSE = MM_MIM_CLOSE Global Const MIM_DATA = MM_MIM_DATA Global Const MIM_LONGDATA = MM_MIM_LONGDATA Global Const MIM_ERROR = MM_MIM_ERROR Global Const MIM_LONGERROR = MM_MIM_LONGERROR Global Const MOM_OPEN = MM_MOM_OPEN Global Const MOM_CLOSE = MM_MOM_CLOSE Global Const MOM_DONE = MM_MOM_DONE ' device ID for MIDI mapper Global Const MIDIMAPPER = (-1) Global Const MIDI_MAPPER = (-1) ' flags for wFlags parm of midiOutCachePatches(), midiOutCacheDrumPatches() Global Const MIDI_CACHE_ALL = 1 Global Const MIDI_CACHE_BESTFIT = 2 Global Const MIDI_CACHE_QUERY = 3 Global Const MIDI_UNCACHE = 4 ' MIDI output device capabilities structure Type MIDIOUTCAPS wMid As Integer ' manufacturer ID wPid As Integer ' product ID vDriverVersion As Integer ' version of the driver szPname As String * MAXPNAMELEN ' product name (NULL terminated string) wTechnology As Integer ' type of device wVoices As Integer ' # of voices (internal synth only) wNotes As Integer ' max # of notes (internal synth only) wChannelMask As Integer ' channels used (internal synth only) dwSupport As Long ' functionality supported by driver End Type ' flags for wTechnology field of MIDIOUTCAPS structure Global Const MOD_MIDIPORT = 1 ' output port Global Const MOD_SYNTH = 2 ' generic internal synth Global Const MOD_SQSYNTH = 3 ' square wave internal synth Global Const MOD_FMSYNTH = 4 ' FM internal synth Global Const MOD_MAPPER = 5 ' MIDI mapper ' flags for dwSupport field of MIDIOUTCAPS structure Global Const MIDICAPS_VOLUME = &H1 ' supports volume control Global Const MIDICAPS_LRVOLUME = &H2 ' separate left-right volume control Global Const MIDICAPS_CACHE = &H4 ' MIDI output device capabilities structure Type MIDIINCAPS wMid As Integer ' manufacturer ID wPid As Integer ' product ID vDriverVersion As Integer ' version of the driver szPname As String * MAXPNAMELEN ' product name (NULL terminated string) End Type ' MIDI data block header Type MIDIHDR lpData As Long ' pointer to locked data block dwBufferLength As Long ' length of data in data block dwBytesRecorded As Long ' used for input only dwUser As Long ' for client's use dwFlags As Long ' assorted flags (see defines) midihdr_tag As Long ' reserved for driver reserved As Long ' reserved for driver End Type ' flags for dwFlags field of MIDIHDR structure Global Const MHDR_DONE = &H1 ' done bit Global Const MHDR_PREPARED = &H2 ' set if header prepared Global Const MHDR_INQUEUE = &H4 ' reserved for driver ' MIDI function prototypes Declare Function midiOutGetNumDevs Lib "MMSYSTEM" () As Integer Declare Function midiOutGetDevCaps Lib "MMSYSTEM" (ByVal udeviceid As Integer, lpCaps As MIDIOUTCAPS, ByVal uSize As Integer) As Integer Declare Function midiOutGetVolume Lib "MMSYSTEM" (ByVal udeviceid As Integer, lpdwvolume As Long) As Integer Declare Function midiOutSetVolume Lib "MMSYSTEM" (ByVal udeviceid As Integer, ByVal dwVolume As Long) As Integer Declare Function midiOutGetErrorText Lib "MMSYSTEM" (ByVal uError As Integer, ByVal lpText As String, ByVal uSize As Integer) As Integer Declare Function midiOutOpen Lib "MMSYSTEM" (lphMidiOut As Integer, ByVal udeviceid As Integer, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal dwFlags As Long) As Integer Declare Function midiOutClose Lib "MMSYSTEM" (ByVal hMidiOut As Integer) As Integer Declare Function midiOutPrepareHeader Lib "MMSYSTEM" (ByVal hMidiOut As Integer, lphMidiOut As MIDIHDR, ByVal uSize As Integer) As Integer Declare Function midiOutUnprepareHeader Lib "MMSYSTEM" (ByVal hMidiOut As Integer, lphMidiOut As MIDIHDR, ByVal uSize As Integer) As Integer Declare Function midiOutShortMsg Lib "MMSYSTEM" (ByVal hMidiOut As Integer, ByVal dwMsg As Long) As Integer Declare Function midiOutLongMsg Lib "MMSYSTEM" (ByVal hMidiOut As Integer, lphMidiOut As MIDIHDR, ByVal uSize As Integer) As Integer Declare Function midiOutReset Lib "MMSYSTEM" (ByVal hMidiOut As Integer) As Integer Declare Function midiOutCachePatches Lib "MMSYSTEM" (ByVal hMidiOut As Integer, ByVal uBank As Integer, ByVal PatchArray As Long, ByVal uFlags As Integer) As Integer Declare Function midiOutCacheDrumPatches Lib "MMSYSTEM" (ByVal hMidiOut As Integer, ByVal uPatch As Integer, lpwKeyArray As Integer, ByVal uFlags As Integer) As Integer Declare Function midiOutGetID Lib "MMSYSTEM" (ByVal hMidiOut As Integer, lpudeviceid As Integer) As Integer Declare Function midiOutMessage Lib "MMSYSTEM" (ByVal hMidiOut As Integer, ByVal uMessage As Integer, ByVal dw1 As Long, ByVal dw2 As Long) As Long Declare Function midiInGetNumDevs Lib "MMSYSTEM" () As Integer Declare Function midiInGetDevCaps Lib "MMSYSTEM" (ByVal udeviceid As Integer, lpCaps As MIDIINCAPS, ByVal uSize As Integer) As Integer Declare Function midiInGetErrorText Lib "MMSYSTEM" (ByVal uError As Integer, ByVal lpText As String, ByVal uSize As Integer) As Integer Declare Function midiInOpen Lib "MMSYSTEM" (lphMidiIn As Integer, ByVal udeviceid As Integer, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal dwFlags As Long) As Integer Declare Function midiInClose Lib "MMSYSTEM" (ByVal hMidiIn As Integer) As Integer Declare Function midiInPrepareHeader Lib "MMSYSTEM" (ByVal hMidiIn As Integer, lpMidiInHdr As MIDIHDR, ByVal uSize As Integer) As Integer Declare Function midiInUnprepareHeader Lib "MMSYSTEM" (ByVal hMidiIn As Integer, lpMidiInHdr As MIDIHDR, ByVal uSize As Integer) As Integer Declare Function midiInAddBuffer Lib "MMSYSTEM" (ByVal hMidiIn As Integer, lpMidiInHdr As MIDIHDR, ByVal uSize As Integer) As Integer Declare Function midiInStart Lib "MMSYSTEM" (ByVal hMidiIn As Integer) As Integer Declare Function midiInStop Lib "MMSYSTEM" (ByVal hMidiIn As Integer) As Integer Declare Function midiInReset Lib "MMSYSTEM" (ByVal hMidiIn As Integer) As Integer Declare Function midiInGetID Lib "MMSYSTEM" (ByVal hMidiIn As Integer, lpudeviceid As Integer) As Integer Declare Function midiInMessage Lib "MMSYSTEM" (ByVal hMidiIn As Integer, ByVal uMessage As Integer, ByVal dw1 As Long, ByVal dw2 As Long) As Long